import {BASE_URL} from './config'
export const chooseImage = (count = 9, sizeType = ['original', 'compressed'], sourceType = ['album', 'camera']) => {

	return new Promise((resolve, reject) => {

		uni.chooseImage({
			count, //默认9
			sizeType, //可以指定是原图还是压缩图，默认二者都有
			sourceType, //从相册选择
			success: function(res) {
				resolve(res.tempFilePaths)
			},
			fail() {
				reject()
			}

		});


	})
}
export const uploadFile = (filePath) => {

	return new Promise((resolve, reject) => {

uni.uploadFile({
							url: BASE_URL+'upload/add', //仅为示例，非真实的接口地址
							filePath,
							name: 'file',
							header:{'Authorization':uni.getStorageSync("token")},
							success: (uploadFileRes) => {
								
								resolve(JSON.parse(uploadFileRes.data))
							 
								
							}
						});

	})
}